From 0b27f90fb76a2492c17a958b6dd807e6fbbf8030 Mon Sep 17 00:00:00 2001 From: Sebastien Castiel Date: Thu, 7 Dec 2023 16:44:01 -0500 Subject: Titles and navigation --- src/app/groups/[groupId]/layout.tsx | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'src/app/groups/[groupId]/layout.tsx') diff --git a/src/app/groups/[groupId]/layout.tsx b/src/app/groups/[groupId]/layout.tsx index 5b99dd2..5fbd7cb 100644 --- a/src/app/groups/[groupId]/layout.tsx +++ b/src/app/groups/[groupId]/layout.tsx @@ -1,31 +1,39 @@ import { GroupTabs } from '@/app/groups/[groupId]/group-tabs' import { SaveGroupLocally } from '@/app/groups/[groupId]/save-recent-group' -import { Button } from '@/components/ui/button' import { getGroup } from '@/lib/api' -import { ChevronLeft } from 'lucide-react' +import { Metadata } from 'next' import Link from 'next/link' import { notFound } from 'next/navigation' import { PropsWithChildren } from 'react' +type Props = { + params: { + groupId: string + } +} + +export async function generateMetadata({ + params: { groupId }, +}: Props): Promise { + const group = await getGroup(groupId) + + return { + title: { + default: group?.name ?? '', + template: `%s · ${group?.name} · Spliit`, + }, + } +} + export default async function GroupLayout({ children, params: { groupId }, -}: PropsWithChildren<{ - params: { groupId: string } -}>) { +}: PropsWithChildren) { const group = await getGroup(groupId) if (!group) notFound() return ( <> -
- -
-

{group.name}

-- cgit v1.3